<template>
	<view class="collect">
		<view class="headerbox">
			<view class="header">
				<uni-icons class="icon" type="left" size="50rpx" color="#fff" @click="backHandler"></uni-icons>
				<text class="title">我的收藏</text>
			</view>
			<view class="tabbar">
				<view class="nav" @click="active = 0">
					<text :class="active == 0? 'con':''">岗位收藏</text>
					<view class="line" :class="active == 0? 'active':''">
					</view>
				</view>
				<view class="nav" @click="active = 1">
					<text :class="active == 1? 'con':''">公司收藏</text>
					<view class="line" :class="active == 1? 'active':''">
					</view>
				</view>
			</view>
		</view>
		<view class="content" v-if="active == 0">
			<view class="list">
				<card-item :worklists='collectWorkList'></card-item>
			</view>
		</view>

		<view class="content" v-if="active == 1">
			<view class="lists">
				<corporationItem :companyList='collectCompanyList'></corporationItem>
			</view>
		</view>
	</view>
</template>

<script>
	import cardItem from "/components/cardItem/cardItem.vue"
	export default {
		data() {
			return {
				active: "0",
				collectWorkList: JSON.parse(localStorage.getItem("collectWorkList")) || [],
				collectCompanyList: JSON.parse(localStorage.getItem("collectCompanyList")) || [],
			};
		},
		methods: {
			backHandler() {
				uni.navigateBack()
			},
		},
		//注册组件
		components: {
			cardItem
		},
	}
</script>

<style lang="scss">
	.collect {
		.headerbox {
			height: 200rpx;
			background-color: #63af56;

			.header {
				display: flex;
				padding: 40rpx 30rpx;
				align-items: center;
				justify-content: center;
				position: relative;

				.title {
					flex: 1;
					text-align: center;
					font-size: 36rpx;
					color: #fff;
					// font-weight: bold;
				}

				.icon {
					position: absolute;
					top: 50%;
					left: 30rpx;
					transform: translate(0, -50%);

				}
			}

			.tabbar {
				display: flex;
				justify-content: space-around;

				.nav {
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;

					text {
						font-size: 28rpx;
						color: #fff;
						opacity: 0.7;
					}

					.line {
						width: 30rpx;
						height: 4rpx;
						background-color: #fff;
						margin-top: 10rpx;
						opacity: 0;
					}

					.con {
						opacity: 1;
					}

					.active {
						opacity: 1;
					}
				}
			}

		}
		.content{
			.lists{
				padding: 30rpx;
			padding-bottom: 100rpx;
			background-color: #fefefe;
			}
			
		}
	}
</style>
